#include "timer_queue.h"
#include "typecast_params.h"
#include "typecast_socket.h"

static struct timer ta_timer;  // timer to send TA

static void ta_timeout(void *arg); 

void start_ta_timer()
{
    if (ta_timer.used) { 
        return; 
    }
    ta_timer.handler = &ta_timeout; 
    ta_timer.data = NULL; 
    timer_set_timeout(&ta_timer, TA_INTERVAL); 
}

void stop_ta_timer()
{
   timer_remove(&ta_timer); 
}

void ta_timeout(void * arg)
{
   typecast_send_TA(); 
   //@TODO: add jitter here. 
   timer_set_timeout(&ta_timer, TA_INTERVAL); 
}
